<?php
/**
 * 成员管理
 * @author goss,<goss@lunluoren.com>
 *
 */
class MemberAction extends AdministratorAction {

	
	protected $modelObj = null;
	
	public function _initialize(){
		parent::_initialize();
		$this->modelObj = D('Member');
	}
	
	public function index(){
		load('extend');
		import('ORG.Util.Page');
		//每页显示数
		$perpage = C('PER_PAGE');
		$keyword = $this->_get('keyword');
		$where = array();
		if ( $keyword !='' ){
			$where[] = "name LIKE '%$keyword%'";
			$where[] = "en_name LIKE '%$keyword%'";
		}
		$where_str = implode(' OR ', $where);
		$count = $this->modelObj ->where($where_str)->count();
		$Page = new Page($count,$perpage);
		$show = $Page->show();
		$limit = $Page->firstRow.','.$Page->listRows;
		$order = 'uid desc';
		$members = $this->modelObj ->getMembers($where_str, $limit, $order);
		$this->assign('members',$members);
		$this->assign('page',$show);
		$this->display();
	}
	
	public function edit(){
		$roles = F('roles');
		$this->assign('roles',$roles);
		parent::edit();
	}
	
	protected  function _checkFormData(){
		if ( empty($_POST['name']) ){
			
		}
	}
	
	public function editVideo(){
		$videoAction = A('Admin/Video');
		$videoAction->edit();
	}
	
	public function editPhoto(){
		$photoAction = A('Admin/Photo');
		$photoAction->edit();
	}
}